<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>easytrip</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/base.css">
    <link rel="stylesheet" href="../css/easytrip-header.css">
    <link rel="stylesheet" href="../css/easytrip-user-supplyadd.css">
    <link rel="stylesheet" href="../lib/layui/css/layui.css">
    <link rel="shortcut icon" href="../favicon.ico"/>
</head>
<body>
<!--固定模块-->
<div id="public-style">
</div>
<!--订单详情页面-->
<div class="content w clearfix">
    <div id="public-side"></div>
    <div class="user-supplyadd-content">
        <div class="supplyadd-content-form">
            <div class="supplyadd-content-header">
                <div class="content-header-info">
                    供应商信息
                </div>
            </div>
            <div class="supplyadd-content-table">
                <form class="layui-form" action="">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">供应商名称:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="username" lay-verify="required" placeholder="请输入供应商名称"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">编号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="username" lay-verify="required" placeholder="请输入编号"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">类别:</label>
                            <div class="layui-input-inline">
                                <select name="modules" lay-verify="required" lay-search="">
                                    <option value="">请选择</option>
                                    <option value="1">layer</option>
                                    <option value="2">form</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">签约人:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="username" lay-verify="required" placeholder="请输入签约人"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">签约时间:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="username" lay-verify="required" placeholder="请输入时间"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">签约人电话:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="username" lay-verify="required" placeholder="请输入电话"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">合同:</label>
                            <div class="layui-input-inline">
                                <span class="export-bill roomstyle-price1" type="button" onclick="method5('tableExcel')" onclick="method2('tableExcel')">导出账单</span>
                                <span class="roomstyle-price" style="margin-left: 20px">点击下载，若无请上传</span>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">结算周期:</label>
                            <div class="layui-input-inline">
                                <select name="modules" lay-verify="required" lay-search="">
                                    <option value="">请选择</option>
                                    <option value="1">周结</option>
                                    <option value="2">月结</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">结算时间:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="username" lay-verify="required" placeholder="请输入"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>

                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">联系电话:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="username" lay-verify="required" placeholder="请输入联系电话"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">邮箱:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="username" lay-verify="required" placeholder="请输入邮箱"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">账号:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="username" lay-verify="required" placeholder="请输入账号"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">密码:</label>
                        <div class="layui-input-inline">
                            <input type="password" name="username" lay-verify="required" placeholder="请输入密码"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline ">
                            <label class="layui-form-label">房型信息:</label>
                            <table class="layui-table" lay-skin="line">
                                <colgroup>
                                    <col width="190">
                                    <col width="150">
                                    <col width="150">
                                    <col width="150">
                                </colgroup>
                                <thead>
                                <tr>
                                    <th>房型</th>
                                    <th>低价</th>
                                    <th>房量</th>
                                    <th>早餐</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td>标准单人间</td>
                                    <td>260</td>
                                    <td>10</td>
                                    <td>1</td>
                                </tr>
                                <tr>
                                    <td>标准单人间</td>
                                    <td>260</td>
                                    <td>10</td>
                                    <td>1</td>
                                </tr>
                                <tr>
                                    <td>标准单人间</td>
                                    <td>260</td>
                                    <td>10</td>
                                    <td>1</td>
                                </tr>
                                <tr>
                                    <td>标准单人间</td>
                                    <td>260</td>
                                    <td>10</td>
                                    <td>1</td>
                                </tr>
                                <tr>
                                    <td>标准单人间</td>
                                    <td>260</td>
                                    <td>10</td>
                                    <td>1</td>
                                </tr>
                                <tr>
                                    <td>标准单人间</td>
                                    <td>260</td>
                                    <td>10</td>
                                    <td>1</td>
                                </tr>
                                <tr>
                                    <td>标准单人间</td>
                                    <td>260</td>
                                    <td>10</td>
                                    <td>1</td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="supplyadd-rightform">
                                <button class="layui-btn" lay-submit="" lay-filter="demo1">保存</button>
                                <button type="reset" class="layui-btn layui-btn-primary">取消</button>
                                <div type="" class="button5 return">返回</div>
                    </div>
                </form>
            </div>
        </div>
        <div class="easytrip-footer">
            copyright by 湖南易旅科技有限公司 2017
        </div>
    </div>
</div>
<script type="text/javascript" src="../lib/jquery.min.js"></script>
<script src="../lib/layui/layui.all.js"></script>
<script src="../js/base.js"></script>
<script src="../js/easytrip-user-supplyadd.js"></script>
<script language="JavaScript" type="text/javascript">
    function method2(tableid)
    {

        var curTbl = document.getElementById(tableid);
        var oXL = new ActiveXObject("Excel.Application");
        var oWB = oXL.Workbooks.Add();
        var oSheet = oWB.ActiveSheet;
        var Lenr = curTbl.rows.length;
        for (i = 0; i < Lenr; i++)
        {        var Lenc = curTbl.rows(i).cells.length;
            for (j = 0; j < Lenc; j++)
            {
                oSheet.Cells(i + 1, j + 1).value = curTbl.rows(i).cells(j).innerText;

            }

        }
        oXL.Visible = true;
    }

    //第五种方法
    var idTmr;
    function  getExplorer() {
        var explorer = window.navigator.userAgent ;
        //ie
        if (explorer.indexOf("MSIE") >= 0) {
            return 'ie';
        }
        //firefox
        else if (explorer.indexOf("Firefox") >= 0) {
            return 'Firefox';
        }
        //Chrome
        else if(explorer.indexOf("Chrome") >= 0){
            return 'Chrome';
        }
        //Opera
        else if(explorer.indexOf("Opera") >= 0){
            return 'Opera';
        }
        //Safari
        else if(explorer.indexOf("Safari") >= 0){
            return 'Safari';
        }
    }
    function method5(tableid) {
        if(getExplorer()=='ie')
        {
            var curTbl = document.getElementById(tableid);
            var oXL = new ActiveXObject("Excel.Application");
            var oWB = oXL.Workbooks.Add();
            var xlsheet = oWB.Worksheets(1);
            var sel = document.body.createTextRange();
            sel.moveToElementText(curTbl);
            sel.select();
            sel.execCommand("Copy");
            xlsheet.Paste();
            oXL.Visible = true;

            try {
                var fname = oXL.Application.GetSaveAsFilename("Excel.xls", "Excel Spreadsheets (*.xls), *.xls");
            } catch (e) {
                print("Nested catch caught " + e);
            } finally {
                oWB.SaveAs(fname);
                oWB.Close(savechanges = false);
                oXL.Quit();
                oXL = null;
                idTmr = window.setInterval("Cleanup();", 1);
            }

        }
        else
        {
            tableToExcel(tableid)
        }
    }
    function Cleanup() {
        window.clearInterval(idTmr);
        CollectGarbage();
    }
    var tableToExcel = (function() {
        var uri = 'data:application/vnd.ms-excel;base64,',
            template = '<html><head><meta charset="UTF-8"></head><body><table>{table}</table></body></html>',
            base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) },
            format = function(s, c) {
                return s.replace(/{(\w+)}/g,
                    function(m, p) { return c[p]; }) }
        return function(table, name) {
            if (!table.nodeType) table = document.getElementById(table)
            var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
            window.location.href = uri + base64(format(template, ctx))
        }
    })()
</script>
</body>
</html>